
function handleRefComment($vessel) {
    var $child = $vessel.find('>.ref');
    var $h4, matched = false;

    $h4 = $vessel.find('>h4');

    for (var i = 0, h4Text$ = $h4.text().toLowerCase(); i < blockerConfig.blockedUsers.length; ++i) {
        if (h4Text$ == '引用来自“' + blockerConfig.blockedUsers[i] + '”的评论') {
            matched = true;
            break;
        }
    }

    if ($vessel.find('>.ref').length > 0) {

        handleRefComment($child);

        if (matched) {
            $vessel.html(
                $vessel.find('>.ref').prop('outerHTML') + 
                $vessel.find('>h4').prop('outerHTML') + 
                blockerConfig.blockedTips
            );
        }

    } else {

        if (matched) {
            $vessel.html(
                $h4.prop('outerHTML') + 
                blockerConfig.blockedTips
            );
        }
    }

}

prLoaded.then(function() {

    $('#userComments > ul > li').each(function() {

        if (blockerConfig.blockedUsers.indexOf($(this).find('.r_title > b').text().toLowerCase()) >= 0) {
            if ($(this).find('.opts > a').length > 0) {
                $(this).find('.r_content').html(blockerConfig.blockedTips);
            } else {
                if ($(this).find('.r_content > .ref').length > 0) {
                    handleRefComment($(this).find('.r_content > .ref'));
                }
            }
        } else {
            if ($(this).find('.r_content > .ref').length > 0) {
                handleRefComment($(this).find('.r_content > .ref'));
            }
        }
    });

});
